var index = {
    URL: {
        getLoginInfoUrl: "../login/getLoginInfo",
        getMenuUrl: "../menu/getMenu",
        loginOutUrl: "../login/loginOut",
        loginOutUrl: "../login/loginOut",
    },
    detail: {
        updPsd:function(){

        },
        loginOut: function () {
            BUI.Message.Confirm('您确定要退出后台吗？', function () {
                layer.load();
                $.ajax({
                    url: index.URL.loginOutUrl,
                    data: {},
                    dataType: "json",
                    type: "post",
                    async: true,
                    success: function (data) {
                        layer.closeAll('loading');
                        if (!data.hasError) {
                            top.location.href = data.errUrl;
                            return false;
                        } else {
                            BUI.Message.Alert(data.error, 'warning');
                        }
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        layer.closeAll('loading');
                        BUI.Message.Alert("系统繁忙，请稍后" + XMLHttpRequest.status + ","
                            + XMLHttpRequest.readyState + "," + textStatus, function () {
                        }, 'warning');
                    }
                });
            }, 'question');
        },
        init: function () {
            $.ajax({
                url: index.URL.getLoginInfoUrl,
                data: {},
                dataType: "json",
                type: "post",
                async: true,
                success: function (data) {
                    if (!data.hasError) {
                        //alert(JSON.stringify(data));
                        // 这是我们的 Model
                        var exampleData = {
                            greeting: true,//是否插入值，默认为true
                            user: data.object.account,
                        }
                        // 创建一个 Vue 实例或 "ViewModel"
                        // 它连接 View 与 Model
                        var exampleVM = new Vue({
                            el: '#wel',
                            data: exampleData
                        });
                        BUI.use('common/main', function () {
                            $.ajax({
                                url: index.URL.getMenuUrl,
                                data: {},
                                dataType: "json",
                                type: "post",
                                async: true,
                                success: function (data) {
                                    if (!data.hasError) {
                                        var config = [{
                                            id: 'menu',
                                            homePage: 'main-menu', //默认打开的主页
                                            menu: data.object,
                                        }];
                                        new PageUtil.MainPage({
                                            modulesConfig: config
                                        });
                                    } else {
                                        BUI.Message.Alert(data.error, function () {
                                            if (data.errType == "NOSESSION") {
                                                top.location.href = data.errUrl;
                                                return false;
                                            }
                                        }, 'warning');
                                    }
                                },
                                error: function (XMLHttpRequest, textStatus, errorThrown) {
                                    BUI.Message.Alert("系统繁忙，请稍后" + XMLHttpRequest.status + ","
                                        + XMLHttpRequest.readyState + "," + textStatus, function () {
                                    }, 'warning');
                                }
                            });
                        });
                    } else {
                        BUI.Message.Alert(data.error, function () {
                            top.location.href = data.errUrl;
                        }, 'warning');
                    }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    BUI.Message.Alert("系统繁忙，请稍后" + XMLHttpRequest.status + ","
                        + XMLHttpRequest.readyState + "," + textStatus, function () {
                    }, 'warning');
                }
            });
        },
    },
}